package com.my.chapter12;

public class practice13 {
    static void f(int index) throws Exception{
        switch (index){
            case 0:throw new MyException1();
            case 1:throw new MyException2();
            case 2:throw new MyException3();
            case 3:throw new NullPointerException();
        }
    }

    public static void main(String[] args) {
        int index = 0;
        while(true){
            try {
                f(index++);
            }catch (Exception e){
                e.printStackTrace();
            }finally {
                System.out.println("finally index= "+index);
                if(index==4){
                    break;
                }
            }
        }
    }
}
